let express = require('express')
import { createServer } from 'http'
import { Server } from 'socket.io'

// 引入类
import Game from './model/Game'

// socket.io的官方demo就是结合express的，网址：https://socket.io/docs/v4/tutorial/introduction
const app = express()
const server = createServer(app)
const io: Server = new Server(server)

// 使用静态资源文件夹。
// public文件夹是静态文件，为了方便每次上传到服务器上更新
app.use(express.static('public'))
app.use(express.static('public_jslib'))

// 运行Game
new Game(io)

server.listen(3000, () => {
    console.log('server running 3000 port')
})